package com.allwees.bs.c.module.order.dto;

import com.allwees.bs.c.module.order.entity.OrderReviewEntity;
import com.allwees.bs.c.module.user.dto.UserDto;
import com.allwees.bs.c.module.user.service.IUserService;
import com.allwees.core.common.util.BeanUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * 订单评价
 *
 * @author jy2016
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
//@ApiModel
public class OrderReviewDTO implements Serializable {
//    @ApiModelProperty(value = "订单评价ID")
    private String uuid;

//    @ApiModelProperty(value = "评价用户")
    private UserDto user;

//    @ApiModelProperty(value = "评分1到5")
    private Integer rating;

//    @ApiModelProperty(value = "评价内容")
    private String text;

//    @ApiModelProperty(value = "创建时间")
    private Date createdAt;

    public OrderReviewDTO(OrderReviewEntity entity) {
    	this();
        this.uuid = entity.getUuid();
        this.rating = entity.getRating();
        this.text = entity.getText();
        this.createdAt = entity.getCreatedAt();
        this.user = new UserDto(BeanUtil.getBean(IUserService.class).findByUserUuid(entity.getUserUuid()));
    }
}
